package com.jia.lidao.ui.order;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.jia.lidao.R;
import com.jia.lidao.ui.BaseActivity;
import com.jia.lidao.ui.personal.ContentFragment;
import com.jia.lidao.ui.personal.adapter.TabAdapter;
import com.jia.lidao.utils.LogUtil;
import com.jia.lidao.widget.CommonTitleBar;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by jia on 17/12/18.
 */

public class OrderList2Activity extends BaseActivity {

    private TabLayout tabLayout;

    private ViewPager viewPager;

    private TabAdapter adapter;

    private List<Fragment> fragments;

    private CommonTitleBar titleBar;

    private int page;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        page=getIntent().getIntExtra("page",0);
        setContentView(R.layout.activity_orderlist2);
        tabLayout = (TabLayout) findViewById(R.id.tab_essence);
        viewPager = (ViewPager) findViewById(R.id.fr_viewpager);
        initView();
        initData();
    }


    private void initView() {
        fragments = new ArrayList<>();
        final String[] titles = getResources().getStringArray(R.array.order_tab);
        fragments.add(ContentFragment.newInstance(1, 0));
        fragments.add(ContentFragment.newInstance(1, 1));
        fragments.add(ContentFragment.newInstance(1, 3));
        fragments.add(ContentFragment.newInstance(1, 4));
        fragments.add(ContentFragment.newInstance(1, 6));
        adapter = new TabAdapter(getSupportFragmentManager(), fragments, titles);
        viewPager.setAdapter(adapter);
        viewPager.setCurrentItem(page);
        viewPager.setOffscreenPageLimit(5);
        tabLayout.setupWithViewPager(viewPager);
        titleBar = (CommonTitleBar) findViewById(R.id.common_title_bar);
        titleBar.setTitle("配送订单");
    }


    private void initData() {
    }
}
